﻿@section header
{<!-- Bellows Styles -->
    <link href="~/Themes/RongJi/Style/base/css/search.css?v=1" rel="stylesheet" />
    <style>
        .pageHeaderMini {
            display: none;
        }
    </style>
}
@section title
{
蓉记鲜鲜鲜卡券列表
}
@section pagetitle
{
蓉记鲜鲜鲜卡券列表
}
@model RiderShop.Mobile.Modle.RevicePromotionCode.RevicePromotionCodeModel

<div data-role="container" class="product-container glist">
    <input type="hidden" value="1" id="pageIndex">
    <div class="rotate_body">
        <section data-role="body" class="body">
            @if (Model.CardList == null)
            {
                <div class="noresult">
                    <div class="inner-wrapper">
                        <h1>十分抱歉，暂时没有卡券</h1>
                    </div>
                </div>
            }
            else
            {
                <div>
                    <ul id="produt_list" class="glist_ul glist_grid">
                        @{var number = 1;}
                        @foreach (var item in Model.CardList)
                        {
                            <li>
                                <a href="#" onclick="goRevicePromotionCode('@number','p4RWNuMm6E3MoAdhhH0jOqXANG8Y');" id=" @Html.Raw("batchAddCard" + number)">
                                    <div>
                                        <span class="img_wrap">
                                            @*                                                <img src="" style="background-image:url(@item.ActualImageUrl);">*@
                                        </span>
                                        <div class="itemFeaturesWeb" id="">
                                            item.title
                                                @Html.Raw("item.title")
                                        </div>
                                        <div class="itemFeaturesView">
                                            @Html.Raw("item.WebDescription")
                                        </div>
                                    </div>
                                    <div class="clearfix">
                                        <label class="title">@item.least_cost</label>
                                        <p>
                                            <label class="price1">@Html.Raw("item.title")</label>
                                            <label class="price2" style="display: none;">原价：￥0.00</label>
                                            <span class="discount" style="display: none;">0折 </span>
                                        </p>
                                    </div>
                                </a>
                            </li>
                            number++;
                        }
                    </ul>
                </div>
            }
        </section>
    </div>
</div>
@section footer
{
    <script>
        var readyFunc = function onBridgeReady(num, cardId) {
            document.querySelector('#batchAddCard' + num).addEventListener('click',
            function (e) {
                WeixinJSBridge.invoke('batchAddCard',
                {
                    "card_list": [
                    {
                        "card_id": cardId,
                        "card_ext":
                        "{\"timestamp\":\"1420605227\",\"signature\":\"017bb17407c8e0058a66d72dcc61632b70f511ad\"}"
                    }]
                },
                function (res) { });
            });
        }

        function goRevicePromotionCode(num, cardId) {
            if (typeof WeixinJSBridge === "undefined") {
                document.addEventListener('WeixinJSBridgeReady', readyFunc(num, cardId), false);
            }
            else {
                readyFunc(num, cardId);
            }
        }
    </script>
}
